var express = require('express');
var router = express.Router();
var business = require("../app_modules/business.js");
var tool = require("../app_modules/tools.js");

router.post('/functionRouter', function (req, res, next) {
   var functionName=tool.getObj(req.body.Function,"");
   var metadata=tool.getObj(req.body.MetaData,"");
   console.log(metadata);
   if(functionName==""){
      return res.send({status:"0",msg:"function is required.",metadata:""});
   }  
   switch(functionName){
       case "getuser":business.getuser(metadata,function(data){return res.send(data);});break;
       default:
       return res.send({status:"0",msg:"function is not exist.",metadata:""});
   }
   
});

module.exports = router;    